import Home from '@/views/Home'
import VueFooter from '@/components/VueFooter'
import VueHeader from '@/components/VueHeader'

const Cart = () => import('@/views/Cart')
const Mall = () => import('@/views/Mall')
const My = () => import('@/views/My')
const VueCategory = () => import('@/components/VueCategory')
const Detail = () => import('@/views/Detail')
const ListPage = () => import('@/views/ListPage')
const Search = () => import('@/views/Search')
const SearchShopList = () => import('@/views/SearchShopList')

const routes = [
  {
    path: '/',
    redirect: '/home',
    meta: {
      isTabbar: false,
      isBackShow: false,
      haveSearch: true
    }
  },
  {
    path: '/home',
    name: 'Home',
    components: {
      default: Home,
      'vue-footer': VueFooter,
      'vue-header': VueHeader
    },
    meta: {
      isTabbar: true,
      title: '首页',
      icon: 'home-o',
      isBackShow: false,
      haveSearch: true
    }
  },
  {
    path: '/mall',
    name: 'Mall',
    components: {
      default: Mall,
      'vue-footer': VueFooter,
      'vue-header': VueHeader
    },
    meta: {
      isTabbar: true,
      title: '商城',
      icon: 'shop-collect-o',
      isBackShow: false,
      haveSearch: true
    },
    children: [
      {
        // 动态路由
        path: ':id',
        name: 'VueCategory',
        component: VueCategory,
        meta: {
          isTabbar: true,
          isBackShow: false,
          title: '商城',
          haveSearch: true,
          id: 1
        }
      }
    ]
  },
  {
    path: '/cart',
    name: 'Cart',
    components: {
      default: Cart,
      'vue-footer': VueFooter,
      'vue-header': VueHeader
    },
    meta: {
      isTabbar: true,
      title: '购物车',
      icon: 'shopping-cart-o',
      isBackShow: false,
      haveSearch: false
    }
  },
  {
    path: '/my',
    name: 'My',
    components: {
      default: My,
      'vue-footer': VueFooter,
      'vue-header': VueHeader
    },
    meta: {
      isTabbar: true,
      title: '我的',
      icon: 'user-o',
      isBackShow: false,
      haveSearch: false
    }
  },
  {
    path: '/detail',
    name: 'Detail',
    components: {
      default: Detail,
      'vue-header': VueHeader
    },
    meta: {
      isTabbar: false,
      isBackShow: true,
      haveSearch: false
    }
  },
  {
    path: '/listPage',
    name: 'ListPage',
    components: {
      default: ListPage,
      'vue-header': VueHeader
    },
    meta: {
      title: '返回',
      isBackShow: false,
      haveSearch: true
    }
  },
  {
    path: '/search',
    name: 'Search',
    components: {
      default: Search,
      'vue-header': VueHeader
    },
    meta: {
      title: '返回',
      isBackShow: false,
      haveSearch: true
    }
  },
  {
    path: '/searchShopList',
    name: 'SearchShopList',
    components: {
      default: SearchShopList,
      'vue-header': VueHeader
    },
    meta: {
      title: '返回',
      isBackShow: false,
      haveSearch: true,
      isTabbar: false
    }
  }
]

export default routes
